package com.gupao.ldr.pattern.adapter;

import com.alibaba.fastjson.JSON;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class JSONConverterAdapter extends Converter implements JSONConverter {
    @Override
    public String listToJSONConverter(Object obj) {
        return JSON.toJSONString(obj);
    }


    public static void main(String[] args) {
        JSONConverterAdapter converter=new JSONConverterAdapter();
        List<String> list=new ArrayList<>();
        list.add("张三");
        list.add("李四");
        Map<String, String> map = converter.listToMap(list);

        System.out.println(map);

        String json = converter.listToJSONConverter(map);
        System.out.println(json);
    }
}
